package com.netty.esc.common.amis.base;

import org.springframework.stereotype.Component;

/**
 * @Author: zhaoyang
 * @Data: 2021/10/22 15：01
 * @Description
 */
@Component
public class AmisBaseResponse {

    /**
     * http请求返回的方法，以下都是
     */
    public static AmisBaseResponseVO setResultError(String message) {
        return setResult(AmisBaseStatus.RESCODE_FAILED, message, null);
    }

    public static AmisBaseResponseVO setResultError(Integer status, String message) {
        return setResult(status, message, null);
    }

    public static AmisBaseResponseVO setResultError() {
        return setResult(AmisBaseStatus.RESCODE_FAILED, "error", null);
    }

    public static AmisBaseResponseVO setResultError(Object data) {
        return setResult(AmisBaseStatus.RESCODE_FAILED, "error", data);
    }

    public static AmisBaseResponseVO setResultSuccess(String message) {
        return setResult(AmisBaseStatus.RESCODE_SUCCEED, message, null);
    }
    public static AmisBaseResponseVO setResultSuccess() {
        return setResult(AmisBaseStatus.RESCODE_SUCCEED, "success", null);
    }

    public static AmisBaseResponseVO setResultSuccess(Object data) {
        return setResult(AmisBaseStatus.RESCODE_SUCCEED, "success", data);
    }


    public static AmisBaseResponseVO setResult(Integer status, String message, Object data) {
        return new AmisBaseResponseVO(status, message, data);
    }
}
